import { createBrowserRouter } from 'react-router-dom'
import App from '../App'

// 一级路由下的子路由
const router=createBrowserRouter([
    {
        path:'/',
        element:<App></App>,
        children:[
            {
                path:'/index',
                lazy :async()=>{
                    const {default :Index} = await import ('../pages/index/Index');
                    return {
                        element:<Index></Index>
                    }
                }
            },
            {
                path:'/class',
                lazy :async()=>{
                    const {default :Class} = await import ('../pages/class/Index');
                    return {
                        element:<Class></Class>
                    }
                }
            },
            {
                path:'/cart',
                lazy :async()=>{
                    const {default :Cart} = await import ('../pages/cart/Index');
                    return {
                        element:<Cart></Cart>
                    }
                }
            },
            {
                path:'/my',
                lazy :async()=>{
                    const {default :My} = await import ('../pages/my/Index');
                    return {
                        element:<My></My>
                    }
                }
            }
        ]
    }
])
export default router